<?php
	include("initialize.php");
?>
<html>
	<head>
		<title>Lightsaber Training</title>
		<style type="text/css">
		h1{
			font-family: Arial, Helvetica, sans-serif;
			font-size: 18px;
			color: #000000;
		}
		
		p, .pMirror{
			font-family: "Trebuchet MS", sans-serif;
			font-size: 13px;
			text-align: justify;
			color: #000000;
			margin-right: 8px;
		}

		.schedule{
			border-style: solid;
			border-width: 1px;
			padding: 3px;
		}
		</style>
	</head>
	<body>
	
	<?php
		include("write_functions.php");
		
		connect("localhost", "root", "", "GradeGridDatabase");
		
		$account_query = sprintf("SELECT * FROM account WHERE username = '%s'",
		                          mysql_real_escape_string($_SESSION["username"]));
		$account = mysql_fetch_array(mysql_query($account_query));
		
		//$classname = mysql_real_escape_string($_GET["class"]);
		//$section = mysql_real_escape_string($_GET["section"]);
		$classid = $_GET["classid"];
		
		$class_query = sprintf("SELECT * FROM class WHERE class_id = '%s'",
		                       $classid);
		$class = mysql_fetch_array(mysql_query($class_query));
		
		$course_query = sprintf("SELECT * FROM course WHERE course_id = '%s'",
		                        mysql_real_escape_string($class["course_id"]));
		$course = mysql_fetch_array(mysql_query($course_query));
		
		$school_query = sprintf("SELECT * FROM school WHERE school.account_id = '%s' and school.school_id = '%s'",
		                        mysql_real_escape_string($account["account_id"]),
								mysql_real_escape_string($course["school_id"]));
		$school = mysql_fetch_array(mysql_query($school_query));
		
		if($school["school_name"] != null){
			echo "<h1 style='color: #B4B4B4'>" . $school['school_name'] . "<br />";
			echo $school['college_name'] . "<br />";
			echo $school['department_name'] . "</h1>";
		}
		
		if($account["first_name"] != null && $account["last_name"] != null){
			echo "<p>Instructor: " . $account["first_name"] . " " . $account["last_name"] . "<br />";
			echo "Class: $classname - $section</p>";
		} else{
			echo "<p>Class: $classname - $section</p>";
		}
	?>
	
	<!-- <h1>Obi-Wan Kenobi. <span style="color: #B4B4B4;">Department of Jedi Masters, The Jedi Academy.</span></h1>
	<p>Lightsaber Training</p> -->
	
	<table border="0" class="pMirror schedule" width="50%">
		<tr>
			<td>Student Name</td>
			<td></td>
		</tr>
		<tr>
			<td class="schedule">Alpert, Ricardus</td>
			<td class="schedule">PASS</td>
		</tr>
		<tr>
			<td class="schedule">Skytreader, Loki</td>
			<td class="schedule">PASS</td>
		</tr>
		<tr>
			<td class="schedule">Skywalker, Anakin</td>
			<td class="schedule">PASS</td>
		</tr>
	</table>
	
	
	</body>
</html>